﻿using UnityEngine;
using System.Collections;

public class SelectMenuButton : MonoBehaviour {
	public GameObject scrollMenuObject;
	public GameObject foldMenuObject;
	static bool isClicked = false;
	
	// Use this for initialization
	void Start () {
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	
	void OnClick()
	{
		TweenScale scale;
		if( !isClicked )
		{
			scrollMenuObject.SetActive(true);
			scale = TweenScale.Begin(foldMenuObject, 0.3f, Vector3.one);
			EventDelegate.Set(scale.onFinished, ShowingCallback);
			isClicked = true;
		}
		else
		{
			scale = TweenScale.Begin(foldMenuObject, 0.3f, new Vector3(1f,0f,1f));
			EventDelegate.Set(scale.onFinished, HidingCallback);
			isClicked = false;
		}
	}
	
	void ShowingCallback()
	{
	}
			
	void HidingCallback()
	{
		scrollMenuObject.SetActive(false);
	}
}
